<template>
	<view class="physical-report">
		<u-empty text="暂无报告信息" mode="list" v-if="!load&&!params"></u-empty>
		<view class="physical-report-main" v-show="params">
			<view class="section-box">
				<u-section title="基础信息" :right="false" :bold='false' :line-color='themeColorLight' color="#000000"></u-section>
			</view>
			<view class="physical-report-main-header">
				<view class="card-row"><label>姓&emsp;&emsp;名：</label>{{params.name||''}}</view>
				<view class="card-row"><label>性&emsp;&emsp;别：</label>{{params.sex|transSex}}</view>
				<!-- <view class="card-row"><label>单位名称：</label>{{params.companyName||''}}</view> -->
				<view class="card-row"><label>体检分类：</label>{{params.healthTypeName||''}}</view>
				<view class="card-row"><label>证件号码：</label>{{params.idCard||''}}</view>
				<view class="card-row"><label>婚姻状况：</label>{{params.maritalName||''}}</view>
				<view class="card-row"><label>体检时间：</label>{{params.healthTime||''}}</view>
			</view>
			<view class="div-cut"></view>
			<view class="section-box">
				<u-section title="体检结论" :right="false" :bold='false' :line-color='themeColorLight' color="#000000"></u-section>
			</view>
			<view class="physical-report-main-header">
				<view class="card-row u-border-bottom"><label>体检建议：</label>{{params.suggest||''}}</view>
				<view class="card-row u-border-bottom"><label>体检综述：</label>{{params.summarize||''}}</view>
			</view>
			<view class="section-box">
				<u-section title="报告分类" :right="false" :bold='false' :line-color='themeColorLight' color="#000000"></u-section>
			</view>
			<view class="physical-report-main-content">
				<u-cell-group>
					<u-cell-item :title="item.reportTypeName||''" v-for="(item,i) in dataList" @click='toPage(item)' :key='i'></u-cell-item>
				</u-cell-group>
			</view>
		</view>
		<Load :load="load" />
	</view>
</template>

<script>
	import Load from '@/components/Load/index.vue'
	import { getReportComplete } from '@/api/physical.js'
	import { themeColorLight } from '@/static/js/theme.js'
	export default {
		components:{ Load },
		data() {
			return {
				themeColorLight,
				load:false,
				healthNo:'',
				dataList:[{},{}],
				params:{}
			}
		},
		filters:{
			transSex(val){
				if(val==='0'){
					return '未知'
				}else if(val==='1'){
					return '男'
				}else if(val === '2'){
					return '女'
				}else{
					return ''
				}
			}
		},
		onLoad(op) {
			this.healthNo = op.healthNo||'2002240001'
			this.initData()
		},
		methods: {
			initData(){
				this.load = true
				getReportComplete({healthNo:this.healthNo}).then(data => {
					this.load = false
					if(data){
						this.dataList = data.healthReportList||[]
						this.params = data
					}else{
						this.params = ''
						this.dataList = []
					}
				}).catch(e => {
					this.load = false
					this.params = ''
					this.dataList = []
				})
			},
			toPage(item){
				uni.navigateTo({
					url:'/physical/PhysicalServe/reportDetail?healthNo=' + item.healthNo +`&reportType=${item.reportType}`
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.physical-report{
		min-height: 100%;
		background-color: #FFF;
		&-main{
			.section-box{
				padding: 20rpx 30rpx;
			}
			&-header{
				padding: 20rpx 30rpx;
				>.card-row{
					padding-bottom: 20rpx;
					>label{
						min-width: 150rpx;
					}
				}
			}
			&-content{
				margin-top: 20rpx;
			}
		}
	}
</style>
